package manager
{	
	import flash.display.DisplayObject;
	import flash.events.MouseEvent;
	import flash.ui.Mouse;
	import flash.utils.getTimer;
	
	import utils.DisplayUtil;
	
	import ui.scene.MainScene;

	public class CursorManager extends BaseManager
	{
		private var _isLock:Boolean = false;//是否鎖定鼠標
		
		private var _mouseDownTime:int;//鼠标按下开始的时间
		private var _mouseMoveTime:int;//鼠标移动了多少时间
		private const _leftClickTime:int = 1000; //按住左键鼠标移动寻路
		private var _isMouseDown:Boolean;//是否按下了鼠标左键,是否能鼠标跟随移动i
		
		public function CursorManager()
		{
			
		}
		//--------------------------鼠标事件----------------------------
		//世界上点击鼠标
		public function sceneMouseDownHandler(event:MouseEvent):void {
			//非战斗状态下点在左场景地图上或点聊天消息框上
		    if(event.target is MainScene ){
				_isMouseDown = !_isMouseDown;
				_mouseDownTime = getTimer();
				//当鼠标非默认状态游戏主角不会移动
				//CharManager.getInstance().setGamePlayerXY(event);
			}
		}
		//世界上释放鼠标
		public function sceneMouseUpHandler(event:MouseEvent):void {
			//按下的时间不足
			if( getTimer()-_mouseDownTime < _leftClickTime){
				_isMouseDown = false;
			}
		}
		
		//保证退出游戏 ，换线，换角色后，鼠标恢复默认状态
		override public function destory():void{
		}
	}
}